import requests from './request.js'
// 引入mock模拟数据,进入发送请求
import mockRequests from './mockAjax.js'
// 对API接口进行统一管理
// 获取商品列表数据
export const reqCategoryList = () => requests({url:'/product/getBaseCategoryList',method:'GET'})

//获取首页的 banner floor 轮播图数据
export const reqBannerList = () => mockRequests({url:'/banner',method:'get'})

// 获取floor轮播图的数据
export const reqFloorList = () => mockRequests({url:'/floor',method:'get'}) 

// 获取搜索商品的详情数据

// 请求地址/api/list  请求方式POST
// 需要携带参数params
// category1Id
// category2Id
// category3Id
// categoryName
// keyword
// props
// trademark
// order
// pageNo
// pageSize
export const reqSearchList = (params) => requests({url:'/list',method:'post',data:params})

// 获取商品详情信息
export const reqGoodsInfo = (skyid) => requests({url:`/item/${skyid}`,method:'GET'})

// 获取添加购物车的信息（更新某个商品数量）
export const reqAddupDateShopCart = (skuId,skuNum) => requests({url:`cart/addToCart/${ skuId }/${ skuNum }`,method:'post'})

// 获取购物车列表信息
export const reqCartList = () => requests({url:'/cart/cartList',method:'get'})

// 获取要删除购物车产品的id
export const reqDeleteShopCartById = (skuId) => requests({url:`/cart/deleteCart/${skuId}`,method:'delete'})

// 请求地址: /api/cart/checkCart/{skuID}/{isChecked}
// 获取切换商品状态的选中状态
export const reqCheckCart = (skuId,isChecked) => requests({url:`/cart/checkCart/${skuId}/${isChecked}`,method:'get'})

// 获取验证码接口
// 请求地址 /user/passport/sendCode/{phone}
export const reqSendCode = (phone) => requests({url:`/user/passport/sendCode/${phone}`,method:'get'})

// 获取注册用户接口
export const reqUserRegister = (data) => requests({url:'/user/passport/register',method:'post',data})

// 登陆接口
export const reqUserLogin = (data) => requests({url:`/user/passport/login`,method:'post',data})

// 获取用户信息【需要带着用户的token向服务器要用户信息】
export const reqUserToken = () => requests({url:'/user/passport/auth/getUserInfo',method:'get'})

// 退出登陆
export const reqLoginOut = () => requests({url:'/user/passport/logout',method:'get'})

// 获取用户地址信息接口
export const reqUserAddressList = () => requests({url:'/user/userAddress/auth/findUserAddressList',method:'get'})

// 获取订单交易页信息
export const reqOrderInfo = () => requests({url:'/order/auth/trade',method:"get"})

// 提交订单接口
// /order/auth/submitOrder?tradeNo={tradeNo}
export const reqSubmitOrder = (tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,method:'post',data});
// 获取支付信息接口
// /payment/weixin/queryPayStatus/{orderId}
// 查询支付信息

// 获取我的订单  获取个人中心的数据
// /order/auth/{page}/{limit}

export const reqOrderList = (page,limit) => requests({url:`/order/auth/${page}/${limit}`,method:'get'})
